from flask import session


class SessionCheck:

    @staticmethod
    def check_login():
        if 'user_identity' in session:
            return True
        return False

    @staticmethod
    def set_login(identity):
        if 'user_identity' in session:
            return
        session['user_identity'] = identity

    @staticmethod
    def get_identity():
        if SessionCheck.check_login():
            return session['user_identity']
        return -1

    @staticmethod
    def is_admin():
        if SessionCheck.get_identity() == 0:
            return True
        return False

# user_identity 用户等级

